const BUILD_ENV = require('../../../../src/public/utils/Env');
const { UMI_ENV = '' } = process.env;
const target = JSON.parse(UMI_ENV);
export default {
  /** 接口根地址 */
  getApiPrefix: (() => {
    switch (target) {
      case BUILD_ENV.PROD:
        return 'https://goods.pharmacyyf.com';
      case BUILD_ENV.TEST:
        return 'https://goods-te.pharmacyyf.com';
      case BUILD_ENV.DEV:
        return 'https://goods-te.pharmacyyf.com';
        // return 'http://192.168.235.50:8001';
      default:
        return '';
    }
  })(),
  /**
 *获取跳转地址前缀
 */
  getPublicUrl: (route: string) => {
    switch (target) {
      case BUILD_ENV.PROD:
        return `https://goods.pharmacyyf.com/front/goods-franchise-pricing/${route}.html`;
      case BUILD_ENV.TEST:
        return `http://yf-test-oss.yifengx.com/webtest/franchise-pricing-system${route}.html`;
      case BUILD_ENV.DEV:
        return `http://yf-test-oss.yifengx.com/webtest/franchise-pricing-system${route}.html`;
      default:
        return '';
    }
  },
  /**
 * 下载模板地址
 */
  getFileDownUrl: (fileName: string) => {
    switch (target) {
      case BUILD_ENV.PROD:
        return `https://goods.pharmacyyf.com/front/goods-franchise-pricing/${fileName}`;
      case BUILD_ENV.TEST:
        return `http://yf-test-oss.yifengx.com/webtest/dengcheng/${fileName}`;
      case BUILD_ENV.DEV:
        return `http://yf-test-oss.yifengx.com/webtest/dengcheng/${fileName}`;
      default:
        return '';
    }
  },

  getTemplateDownloadUrl: (fileName: string) => {
    switch (target) {
      case BUILD_ENV.PROD:
        return `https://goods.pharmacyyf.com/front/goods-franchise-pricing/${fileName}`;
      case BUILD_ENV.TEST:
        return `http://yf-test-oss.yifengx.com/webtest/franchise-pricing-system/${fileName}`;
      case BUILD_ENV.DEV:
        return `http://yf-test-oss.yifengx.com/webtest/franchise-pricing-system/${fileName}`;
      default:
        return '';
    }
  },

  /**
   *获取sso前缀地址
   */
  getSSOUrl: (() => {
    switch (target) {
      case BUILD_ENV.PROD:
        return 'https://chief.yifengx.com/';
      case BUILD_ENV.TEST:
        return 'http://chief-te.yifengx.com/';
      case BUILD_ENV.DEV:
        return 'http://chief-te.yifengx.com/';
      default:
        return '';
    }
  })(),
};
